package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description 撤销退保标识
 * @Author WJH
 * @Date 2021/10/21
 */
public enum RevokeFlagEnum {
    INIT(0, "未退保"),
    PROCESSING(1, "退保审核中"),
    SUCCESS(2, "退保审核通过"),
    FAILURE(3, "退保审核拒绝"),
    ;

    RevokeFlagEnum(int flag, String desc) {
        this.flag = flag;
        this.desc = desc;
    }

    private int flag;
    private String desc;

    public int getFlag() {
        return flag;
    }

    public String getDesc() {
        return desc;
    }

    public static RevokeFlagEnum resolve(int flag){
        return Arrays.stream(values()).filter(s -> s.flag == flag).findFirst().orElseThrow(() -> new RuntimeException("未识别的理赔状态[" + flag + "]"));
    }


    @Override
    public String toString() {
        return String.format("%s:%s", flag, desc);
    }
}
